package com.ziven.common.widget.value;

import android.view.View;

import androidx.annotation.NonNull;

import com.ziven.easygo.util.EasyUtils;
import com.ziven.easygo.util.ViewHelper;

/**
 * @author Ziven
 */
public final class SameEffect extends MixValue {

    public static SameEffect values(@NonNull ViewValue... values) {
        return new SameEffect(values);
    }

    private SameEffect(@NonNull ViewValue... values) {
        super(values);
    }

    @Override
    protected void takeEffect(@NonNull ViewHelper<? extends View> helper, @NonNull Value[] values) {
        value(Value.class,
                effect -> EasyUtils.forEach(values,
                        value -> {
                            value.takeEffect(helper.getView());
                            value.myself(ViewValue.class, my -> effect.takeEffect(my.view()));
                        }));
    }
}
